package com.cadre.web.controller.officer;

import com.alibaba.fastjson.JSON;
import com.cadre.common.utils.oldutil.ResultVO;
import com.cadre.system.service.AppointRemoveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

@RequestMapping({"/appointRemove"})
@Api(value = "干部任免接口", tags = {"干部任免表接口"})
@RestController
/* loaded from: AppointRemoveController.class */
public class AppointRemoveController {
    @Autowired
    AppointRemoveService appointRemoveService;

    @PostMapping({"/listPerson"})
    @ApiImplicitParam(name = "personIds", value = "干部人员id", required = true, paramType = "query", defaultValue = "1")
    @ApiOperation("干部任免：干部任免干部列表")
    public ResultVO ge2t(String[] personIds) {
        return this.appointRemoveService.listPerson(personIds);
    }

    @PostMapping({"/exportWord"})
    @ApiImplicitParam(name = "personIds", value = "干部人员id", required = true, paramType = "query", defaultValue = "1")
    @ApiOperation("干部任免：干部任免干部导出")
    public void exportWord(String[] personIds, HttpServletResponse response) {
        this.appointRemoveService.exportWord(personIds, response);
    }

    @ApiImplicitParam(name = "personIds", value = "干部人员id", required = true, paramType = "query", defaultValue = "1")
    @GetMapping({"/printWord"})
    @ApiOperation("干部任免：干部任免干部打印")
    public void printWord(String[] personIds, HttpServletResponse response) {
        System.out.println("printWord=>>>>>");
        this.appointRemoveService.printWord(personIds, response);
    }

    @PostMapping({"/batchPrintWord"})
    @ApiImplicitParam(name = "flowids", value = "干部人员id")
    @ApiOperation("干部任免：干部任免表批量打印")
    public void batchPrintWord(@RequestBody String[] flowids, HttpServletResponse response) {
        this.appointRemoveService.batchPrintWord(flowids, response);
    }

    @PostMapping({"/batchDownWord"})
    @ApiImplicitParam(name = "flowids", value = "干部人员id")
    @ApiOperation("干部任免：干部任免表批量下载")
    public void batchDownWord(@RequestParam String[] flowids, HttpServletResponse response) {
        this.appointRemoveService.batchDownWord(flowids, response);
    }

    @PostMapping({"/exportLrmx"})
    @ApiImplicitParam(name = "personIds", value = "干部人员id", required = true, paramType = "query", defaultValue = "1")
    @ApiOperation("干部任免：干部任免干部Lrmx导出")
    public void exportLrmx(String[] personIds, HttpServletResponse response) {
        this.appointRemoveService.exportLrmx(personIds, response);
    }

    @RequestMapping(value = {"/onlinePrintWord"}, method = {RequestMethod.POST})
    public void onlinePrintWord(@RequestParam String params, HttpServletResponse response) {
        System.out.println(">>>" + params);
        List<Object> list = JSON.parseArray(params);
        List<Map<String, Object>> listmap = new ArrayList<>();
        Iterator<Object> it = list.iterator();
        while (it.hasNext()) {
            listmap.add((Map) it.next());
        }
        this.appointRemoveService.onlinePrintWord(listmap, response);
    }
}
